package com.model.form;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@ApiModel(value = "FrontUserFrom", description = "前端表单对象")
@Getter
@Setter
@ToString
public class FrontUserForm {

    @NotNull(message = "用户名不能为空")
    @Length(min = 4, max = 10, message = "用户名长度必须为4~10个字符")
    @Pattern(regexp = "^[a-zA-Z0-9]+$", message = "用户名必须是英文或数字")
    @ApiModelProperty(value = "username")
    private String username;

    @NotNull(message = "密码不能为空")
    @Length(min = 6, max = 12, message = "密码长度必须为6~12个字符")
    @Pattern(regexp = "^[a-zA-Z0-9]+$", message = "密码必须是英文或数字")
    @ApiModelProperty(value = "password")
    private String password;
}
